import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';

import {AppModule} from './app/app.module';
import {environment} from './environments/environment';
import {HTTP_URLS} from './app/config/app-http.url';
import {AppInfoDto} from './app/basic/basic.model';
import {CommonHttp} from './app/common/common.http';

// 查询系统信息
const commonHttp = new CommonHttp();
const httpModel = commonHttp.get(HTTP_URLS.getMyAppInfo);
const appInfos: Array<AppInfoDto> = JSON.parse(httpModel.data);
for (const appInfo of  appInfos) {
  if (appInfo.key === 'title') {
    document.getElementsByTagName('title')[0].innerText = appInfo.value;
  }
}
localStorage.setItem(environment.appKey, JSON.stringify(appInfos));
if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.error(err));
